extends MoveStateResource


class_name TowardStateResource


func update(ctrl: MoveController, data: Dictionary, delta: float, duration: float) -> bool:
    if ctrl.target == null:
        return true
    var move: MoveComponent = ctrl.move_component
    var stand_position: Vector2 = move.wrapper.global_position
    var destination: Vector2 = ctrl.target.global_position
    var next_position = stand_position.move_toward(destination, move.speed * delta)
    move.direction = (destination - next_position).normalized()
    return false
